/*************************************************************************
 * CS516 Software Engineering
 * Group Project: Android Finance Management System
 * Main.java
 * The start page of the appliacation
 *************************************************************************/
package com.svu.se.group3;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;
/**
 * (add your name below)
 * @author A2303 Lei Jiang 
 */
public class Main extends TabActivity{
	public static DBOpenHelper dbOpenHelper;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Resources res = getResources(); // Resource object to get Drawables
        TabHost tabHost = getTabHost();  // The activity TabHost
        TabHost.TabSpec spec;  // Resusable TabSpec for each tab
        Intent intent;  // Reusable Intent for each tab

        /**
         * Add Transaction Tab
         */
        // Create an Intent to launch an Activity for the tab (to be reused)
        intent = new Intent().setClass(this, AddTransaction.class);

        // Initialize a TabSpec for each tab and add it to the TabHost
        spec = tabHost.newTabSpec("tab_add");
        spec.setIndicator(null, res.getDrawable(R.drawable.tab_add));
        spec.setContent(intent);
        tabHost.addTab(spec);
        
        /**
         * List Transaction Tab
         */
        // Create an Intent to launch an Activity for the tab (to be reused)
        intent = new Intent().setClass(this, ListTransaction.class);

        // Initialize a TabSpec for each tab and add it to the TabHost
        spec = tabHost.newTabSpec("tab_list");
        spec.setIndicator(null, res.getDrawable(R.drawable.tab_list));
        spec.setContent(intent);
        tabHost.addTab(spec);
        
        /**
         * Daily Report Tab
         */
        // Create an Intent to launch an Activity for the tab (to be reused)
        intent = new Intent().setClass(this, DailyReport.class);

        // Initialize a TabSpec for each tab and add it to the TabHost
        spec = tabHost.newTabSpec("tab_report");
        spec.setIndicator(null, res.getDrawable(R.drawable.tab_report));
        spec.setContent(intent);
        tabHost.addTab(spec);

        tabHost.setCurrentTab(0);
        
        // Create database
        dbOpenHelper = new DBOpenHelper(this);
    }
}

